package com.camps.sdk.encrypt;

import com.camps.sdk.common.ExceptionCode;
import com.camps.sdk.entity.Pdop;
import com.camps.sdk.exception.BaseException;

/**
 * @Author ldaoliang
 * @Date create in 10:11 2021/9/1
 * @Description
 */
public class PDOPCommand implements BuildCommand {
    @Override
    public String splicingParameters(String imei, Object params) {
        if(!(params instanceof Pdop)){
            throw new BaseException(ExceptionCode.PARAMETER_ERROR);
        }
        Pdop pdop = (Pdop) params;
        Integer threshold = pdop.getThreshold();
        String commandNumber = pdop.getCommandNumber();
        StringBuffer sb = new StringBuffer("*WT,");
        sb = sb.append(imei).append(",PDOP,").append(commandNumber).append(",").append(threshold).append("#");
        return sb.toString();
    }
}
